package com.altekis.kanbankaze.client;

import java.util.List;

import com.altekis.kanbankaze.server.UserAccountServiceImpl;
import com.altekis.kanbankaze.shared.UserAccount;
import com.google.appengine.api.users.User;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.inject.ImplementedBy;

/**
 * The client side stub for the {@link User} RPC service.
 * 
 * @author lordkhizir
 */
@RemoteServiceRelativePath("GWT.rpc")
@ImplementedBy(UserAccountServiceImpl.class)
public interface UserAccountService extends RemoteService {

	/**
	 * Utility/Convenience class. Use UserService.App.getInstance() to access
	 * static instance of UserServiceAsync
	 */
	public static class App {
		private static final UserAccountServiceAsync ourInstance = (UserAccountServiceAsync) GWT
				.create(UserAccountService.class);

		public static UserAccountServiceAsync getInstance() {
			return ourInstance;
		}
	}

	UserAccount createChannelForCurrentUser();

	String createLoginURL(String callbackUrl);

	String createLoginURL(String callbackUrl, String authDomain);

	String createLogoutURL(String callbackUrl);

	String createLogoutURL(String destinationURL, String authDomain);

	List<UserAccount> findAll();
	
	UserAccount findById(String id);

	UserAccount getCurrentUser();

	boolean isUserAdmin();

	boolean isUserLoggedIn();

	UserAccount save(UserAccount userAccount);

}
